package com.csd.action.message;

import java.util.List;

import com.csd.helper.ActionResult;
import com.csd.helper.IConstant;
import com.csd.serviceImpl.ManagerService;
import com.csd.serviceImpl.TeacherService;
import com.csd.serviceImpl.TeamService;

/**
 * 
 * Action:根据选择，列出发送者列表
 * 
 * @author csd
 * @version 1.0
 * 
 * <br>
 *          修订时间：2009-12-17 <br>
 *          修改原因：创建文件 <br>
 *          修改人：何文深 <br>
 * 
 */
public class ReceiverListAction {

	private String type ;
	
	private String receiverID ;

	private List<Object> list;
	
	private TeacherService teacherService;
	private TeamService teamService;
	private ManagerService managerService;
	
	public List<Object> getList() {
		return list;
	}



	public void setList(List<Object> list) {
		this.list = list;
	}



	public TeacherService getTeacherService() {
		return teacherService;
	}



	public void setTeacherService(TeacherService teacherService) {
		this.teacherService = teacherService;
	}



	public TeamService getTeamService() {
		return teamService;
	}



	public void setTeamService(TeamService teamService) {
		this.teamService = teamService;
	}



	public ManagerService getManagerService() {
		return managerService;
	}



	public void setManagerService(ManagerService managerService) {
		this.managerService = managerService;
	}



	public String getType() {
		return type;
	}



	public void setType(String type) {
		this.type = type;
	}



	public String getReceiverID() {
		return receiverID;
	}



	public void setReceiverID(String receiverID) {
		this.receiverID = receiverID;
	}



	public String execute() throws Exception {
		String result = ActionResult.fail;
		
		if(this.type!=null)
		{
			if(type.equals(IConstant.teamRole))
				list = (List)teamService.listTeam();
			if(type.equals(IConstant.teacherRole))
				list = (List)teacherService.listAllTeacher();
			if(type.equals(IConstant.managerRole))
				list = (List)managerService.listAllManager();
			
			result = ActionResult.success;
			
		}else if(this.receiverID != null)
		{
			result = ActionResult.success;
		}
		
		
		return result;
	}
}
